
/******************************************************************************\
|    Title:        	 FIGUREF11: Year-specific estimates of switching out of    |
|						coverage											   |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000

use congress_yearly.dta, clear

xtset stafferid year

xtreg lobbydirectafter i.switchtouncovered_treatment##i.year experience_imp experience_sq committeestaff_everyear personalstaff_everyear senate_everyear majority_everyear minority_everyear dcoffice_everyear leaderofficestaff_everyear  if posttreat==1 | year==2007, fe nonest cluster(stafferid)

margins, dydx(switchtouncovered_treatment) over(year) noestimcheck

marginsplot, plotopts(connect(none) mcolor(black) lcolor(black)) graphregion(color(white)) yline(0, lcolor(black)) recastci(rspike) ciopts(lcolor(black)) ytitle("Effect estimate for switching") title("") xtitle("Year")